export interface TMotion {
  _id?: string;
  name: string;
  category: number;
  group: number;
  img: string;
  mainPart: Array<string>;
  minorPart: Array<string>;
  description: string;
  canHandle?: boolean;
  tool: number;
}

export type CommonRecord = {
  unit: number;
  sets: number[][];
  recordWay: number;
  setsType: number;
};
export type CommonProps = {
  motionId: string;
  name: string;
  group: number;
  tool: number;
  category: number;
  img: string;
} & CommonRecord;

export type TPlanMotion = {
  uuid: string;
  innerRest: number;
  outerRest: number;
  openInner?: boolean;
  openOuter?: boolean;
} & CommonProps;

export type TPlan = {
  _id?: string;
  name: string;
  motions: TPlanMotion[];
};

export type TRecord = {
  _id: string;
  date?: string;
  takeTime: number;
  // ..motion
} & CommonProps;

export type TCreateRecord = {
  _id?: string;
  date?: string;
  takeTime: number;

  motionId: string;
  name?: string;
} & CommonRecord;

export type TValue = string | number;
export type Option = {
  label: string;
  value: TValue;
  sub?: number;
};

export type TStatus =
  | "warning"
  | "success"
  | "error"
  | "info"
  | "default"
  | "white";

export type IconColor =
  | "primary"
  | "default"
  | "danger"
  | "light"
  | "warning"
  | "white"
  | "default"
  | "success";

export interface IconProps {
  type?: IconColor;
  size?: number;
  circleSize?: number;
  badge?: boolean;
  circle?: string;
  other?: object;
  style?: object;
  onClick?: () => void;
}

export type onChangePlanMotionType = (
  uuid: string,
  key: string,
  value?: any,
  index?: number
) => void;

export type TimingProps = {
  direction?: "up" | "down";
  initialSeconds?: number;
  onChange?: (seconds: number) => void;
  onDone?: () => void;
};

export type NumberEditorProps = {
  label: string;
  initValue: string;
  unitOptions?: Array<{ label: string; value: number }>;
  onConfirm?: (value: number) => void;
};

export type ScrollPickerProps = {
  value: TValue;
  options: Option[];
  itemHeight?: number;
};
